<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib prefix="s" uri="/struts-tags" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="keywords" content="翻译平台、翻译网站、找翻译、找人翻译、法语翻译、英语翻译、日语翻译、德语翻译、意大利语翻译、俄罗斯语、翻译人员、成都翻译、成都翻译员" />
<meta name="description" content="众译，助推翻译事业，选择最佳翻译人员，最迅速、最便捷的网络翻译平台。" />
<title>众译-可信赖的翻译平台-个人中心</title>
<link rel="stylesheet" type="text/css" href="<%=request.getContextPath()%>/css/reset.css" />
<link rel="stylesheet" type="text/css" href="<%=request.getContextPath()%>/css/css.css" />
<link rel="stylesheet" type="text/css" href="<%=request.getContextPath()%>/css/jquery.css" />
<script type="text/javascript" src="<%=request.getContextPath()%>/js/global.js"></script>
<script type="text/javascript" src="<%=request.getContextPath()%>/js/jquery-1.4.2.min.js"></script>
<script type="text/javascript" src="<%=request.getContextPath()%>/js/AjaxAction.js"></script>
<script type="text/javascript">
	$(function (){
		$("#confirm").bind('click', confirm);
	});
	
	var context = '<%=request.getContextPath()%>';
	
	function confirm() {
		var oldpass = $("#oldpass").val();
		var newpass = $("#newpass").val();
		var confirmpass = $("#confirmpass").val();
		
		if (oldpass.isEmpty() || !oldpass.isAlpha() || oldpass.length < 6) {
			$(".error_tips").html('<s:text name="error.oldpass"/>');
		} else if (newpass.isEmpty() || !newpass.isAlpha() || newpass.length < 6) {
			$(".error_tips").html('<s:text name="error.newpass"/>');
		} else if (newpass != confirmpass) {
			$(".error_tips").html('<s:text name="error.confirmpass"/>');
		} else {// 验证通过
			$("#loading").show();
			AjaxAction.executeWithJSON(context + '/passport/', 'new_passwd_execute', $("#post_form").serialize(), successCallback, errorCallbakc);
		}
	}
	
	function successCallback(data, status) {
		if (data.success) {
			$(":password").each(function (){
				$(this).val('');
			});
			
		}
		$(".error_tips").html(decodeURIComponent(data.message));
		$("#loading").hide();
	}
	
	function errorCallbakc() {
		$(".error_tips").html('<s:text name="failure.passwd"/>');
		$("#loading").hide();
	}
</script>
</head>
<body>
<div class="layout">
<jsp:include page="/include/head/top.jsp"/>
<jsp:include page="/include/head/top_nav.jsp"/>
<div class="content">
<jsp:include page="../left.jsp" >
	<jsp:param value="2" name="parent"/>
	<jsp:param value="8" name="child"/>
</jsp:include>
<div class="col_r">
<div class="steps">
<div class="step_part" id="tab1">
<h1><a class="current" onmouseover="setTab(1,0)" href="#">更改密码</a></h1>
</div>
<div id="box1">
<div class="box block">
<form action="#" id="post_form">
<table class="table_data">
	<tr>
		<td align="right" width="30%">用户名：</td>
		<td><s:property value="user.email"/> </td>
		<td>&nbsp;</td>
	</tr>
	<tr>
		<td align="right">旧密码：</td>
		<td><input type="password" class="intxt" name="oldpass" id="oldpass"/></td>
		<td>&nbsp;</td>
	</tr>
	<tr>
		<td align="right">新密码：</td>
		<td><input type="password" class="intxt" name="newpass" id="newpass"/></td>
		<td>&nbsp;</td>
	</tr>
	<tr>
		<td align="right">确认密码：</td>
		<td><input type="password" class="intxt" name="confirmpass" id="confirmpass"/></td>
		<td>&nbsp;</td>
	</tr>
	<tr>
		<td align="right">&nbsp;</td>
		<td><input type="button" class="saveokbtn" id="confirm"/></td>
		<td>&nbsp;</td>
	</tr>
	<tr>
		<td align="right"></td>
		<td colspan="2"><span class="error_tips" style="color:red;"></span></td>
	</tr>
	<tr id="loading" style="display: none;">
		<td align="right"></td>
		<td colspan="2">
				<img src="<%=request.getContextPath() %>/images/loading.gif" alt="loading......" />正在修改,请稍候...
		</td>
	</tr>
</table>
</form>
</div>
<div class="box none">News Box</div>
<div class="box none">Article Box</div>
</div>
</div>
</div>
</div>
<jsp:include page="/include/foot/foot.jsp" />
</div>
</body>
</html>
